package tools
{
	import flash.display.Graphics;
	import flash.display.Shape;
	import flash.display.Sprite;

	/**
	 * 等边三角形
	 * @author sjp
	 *
	 */
	public class Triangle extends Sprite
	{
		public function Triangle(radius:Number, color:uint = 0xFFFF00, alpha:Number = 1.0)
		{
			var g:Graphics = graphics;
			var xPos:Number = 0.0;
			var yPos:Number = 0.0;
			var radians:Number = 0.0;
			g.moveTo(radius, 0);
			g.beginFill(color, alpha);
			radians = 120 / 180 * Math.PI;
			xPos = Math.cos(radians) * radius;
			yPos = Math.sin(radians) * radius;
			g.lineTo(xPos, yPos);
			radians = 240 / 180 * Math.PI;
			xPos = Math.cos(radians) * radius;
			yPos = Math.sin(radians) * radius;
			g.lineTo(xPos, yPos);
			g.endFill();
		}
	}
}